package com.sun.showcase.controller.app.mall;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.sun.showcase.biz.mall.service.SubjectService;
import com.sun.showcase.client.domain.mall.Subject;
import com.sun.showcase.client.query.mall.SubjectQuery;
import com.sun.showcase.pojo.DataGrid;
import com.sun.showcase.pojo.Result;

@Controller("appSubjectController")
@RequestMapping(value="/app/subject") 
public class SubjectController{
	
	@Autowired
	private SubjectService subjectService;
	
	private Result result = new Result();

	/**
	 * 全部数据Subject
	 */
	@ResponseBody
	@RequestMapping(value="list")
	public Result list(SubjectQuery subjectQuery) {
		subjectQuery.setOrderColum("create_date");
		subjectQuery.setShowStatus("1");
		DataGrid dg = subjectService.datagrid(subjectQuery);
		result.setSuccess(true);
		result.setMsg("成功！");
		result.setData(dg);
		return result;
	}
	@ResponseBody
	@RequestMapping(value="get")
	public Result get(String id) {
		Subject dg = subjectService.get(id);
		result.setSuccess(true);
		result.setMsg("成功！");
		result.setData(dg);
		return result;
	}
}
